package com.mercator.client.graph;

import org.vaadin.gwtgraphics.client.DrawingArea;
import org.vaadin.gwtgraphics.client.shape.Rectangle;

public class GenSetNode extends GenStringNode<Rectangle> implements Drawable {
	
	public GenSetNode(DrawingArea canvas, GenType element) {
		super(canvas, element);
		radius = text.getTextWidth() + 30;
		rep.setWidth(radius);
		rep.setHeight(radius/2);
		rep.setStrokeColor("black");
		rep.setFillColor("green");
		text.setFillColor("black");
		//reps.add(text);
		first = true;
	}
	
	public GenSetNode(GeneSet gs){
		super(gs);
	}
	
	public void unselect(){
		super.unselect();
		rep.setFillColor("green");
		text.setFillColor("blue");
	}
	
	
	
	@Override
	public GenSetNode getThis() {
		return this;
	}

	@Override
	public boolean equals(Object o) {
		return this.element.equals(((GenSetNode)o).element);
	}

	@Override
	public int hashcode() {
		return this.element.hashCode();
	}

	@Override
	protected Rectangle getShape() {
		return new Rectangle(0,0,0,0);
	}

	@Override
	protected void setSize(int x, int y) {
		rep.setWidth(x);
		rep.setHeight(y);
	}

	@Override
	protected int getCenterX() {
		return rep.getX() + rep.getWidth()/2;
	}

	@Override
	protected int getCenterY() {
		return rep.getY() + rep.getHeight()/2;
	}

}
